package com.yxx.mapper;

import com.yxx.medicinepojo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @author yuxiangxun
 * @date 2024/9/17
 * @apiNote
 */
@Mapper
public interface UserMapper {
    /**
     * 通过创建时间获取用户统计用户id的个数
     * @param map
     * @return
     */
    Integer countUserIdByCreateTime(Map map);

    /**
     * 通过openId查询微信用户信息
     * @param openId
     * @return
     */
    @Select("select * from user where openId = #{openId}")
    User getByOpenId(String openId);

    /**
     * 新增微信用户信息
     * @param newUser
     */
    void insert(User newUser);

    /**
     * 根据用户id查询用户信息
     * @param wxUserId
     * @return
     */
    @Select("select * from user where id = #{id}")
    User getByUserId(Long wxUserId);

    User selectPhoneById(Long userId);

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);
}
